Skip to content

Instantly share code, notes, and snippets.

@umayr
umayr / recover-deleted-branch.sh
Created April 1, 2016 11:41
How to recover a deleted branch
## Pre-requisite: You have to know your last commit message from your deleted branch.
git reflog
# Search for message in the list
# a901eda HEAD@{18}: commit: <last commit message>
# Now you have two options, either checkout revision or HEAD
git checkout a901eda
# Or
git checkout HEAD@{18}
@aamiaa
aamiaa / CompleteDiscordQuest.md
Last active May 13, 2024 09:01
Complete Recent Discord Quest

Complete Recent Discord Quest

Note

This no longer works in browser!

Note

This no longer works if you're alone in vc! Somebody else has to join you!

How to use this script:

  1. Accept the quest under User Settings -> Gift Inventory
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active May 13, 2024 09:00
set -e, -u, -o, -x pipefail explanation
@maokwen
maokwen / AutoHotKey-Switch-IME.ahk
Last active May 13, 2024 08:57
AutoHotKey-Switch-IME
#Include %A_ScriptDir%
timeInterval := 500
; +-------------------------+-------------------------+
; | SubLanguage ID | Primary Language ID |
; +-------------------------+-------------------------+
; 15 10 9 0 bit
InChs() {
@equivalent
equivalent / README.md
Last active May 13, 2024 08:57
Rails 7 importmaps dropzone.js direct upload ActiveStorage

This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.

A Deep Dive into 'Regular Expressions': A guide on Regex

Have you ever used Control + F to search for a specific word or phrase? You've already used something like regular expressions before! Regular expressions, or regex for short, is a series of special characters that are used to define a search pattern! In context of code or search algorithms, regex can be used to find patterns within strings, or to find and replace characters or series of characters within a string.

Though regex is used in JavaScript, it's actually a universally used component in all languages, such as Python, Java, and C++.

This guide takes a deep dive into what regular expressions are and what they are used for in programming! Let's get started :)

Summary

@alexweberk
alexweberk / mlx_finetuning_gemma.ipynb
Last active May 13, 2024 08:56
MLX Fine-tuning Google Gemma
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@greymd
greymd / sudo新一.md
Last active May 13, 2024 08:55
sudo新一

 オレは高校生シェル芸人 sudo 新一。幼馴染で同級生の more 利蘭と遊園地に遊びに行って、黒ずくめの男の怪しげな rm -rf / 現場を目撃した。端末をみるのに夢中になっていた俺は、背後から近づいてきたもう1人の --no-preserve-root オプションに気づかなかった。 俺はその男に毒薬を飲まされ、目が覚めたら・・・ OS のプリインストールから除かれてしまっていた!

sudo がまだ $PATH に残っていると奴らにバレたら、また命を狙われ、他のコマンドにも危害が及ぶ』

 上田博士の助言で正体を隠すことにした俺は、 which に名前を聞かれて、とっさに『gnuplot』と名乗り、奴らの情報をつかむために、父親がシェル芸人をやっている蘭の $HOME に転がり込んだ。ところが、このおっちゃん・・・とんだヘボシェル芸人で、見かねた俺はおっちゃんになりかわり、持ち前の権限昇格能力で、次々と難タスクを解決してきた。おかげで、おっちゃんは今や世間に名を知られた名エンジニア、俺はといえばシェル芸 bot のおもちゃに逆戻り。クラスメートの convertojichattextimg にお絵かきコマンドと誤解され少年ワンライナーお絵かき団を結成させられる始末。

 ではここで、博士が作ってくれたメカを紹介しよう。最初は時計型麻酔 kill 。ふたについた照準器にあわせてエンターを押せば、麻酔シグナルが飛び出し、プロセスを瞬時に sleep させることができる。 次に、蝶ネクタイ型 banner 。裏についているダイヤルを調整すれば、ありとあらゆる大きさのメッセージを標準出力できる。必殺のアイテムなら fork 力増強シューズ。電気と磁力で足を刺激し、 :(){ :|:&amp; };: でプロセステーブ

@qzchenwl
qzchenwl / elasticsearch-docker-compose.yml
Created April 27, 2024 07:04
elasticsearch docker compose
services:
setup:
image: docker.elastic.co/elasticsearch/elasticsearch:8.13.0
user: "0"
command: >
bash -c '
if [ x${ELASTIC_PASSWORD} == x ]; then
echo "Set the ELASTIC_PASSWORD environment variable in the .env file";
exit 1;
elif [ x${KIBANA_PASSWORD} == x ]; then